package com.example.springweb.config;

import java.util.List;
import org.springframework.context.annotation.Bean;
import io.swagger.v3.oas.annotations.enums.SecuritySchemeIn;
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
import io.swagger.v3.oas.annotations.security.SecurityScheme;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.security.SecurityRequirement;

/**
 * Api页面 http://127.0.0.1:8080/swagger-ui/index.html
 */
@SecurityScheme(name = "Authorization", type = SecuritySchemeType.HTTP, scheme = "bearer", in = SecuritySchemeIn.HEADER)
public class SwaggerConfig {

	@Bean
	public OpenAPI springShopOpenAPI() {
		return new OpenAPI()
				.info(new Info()
				.title("我的API")
				.version("v3")
				.description("这是Swagger 3创建的样本Spring Boot Restful服务。"))
				.security(List.of(new SecurityRequirement().addList("Authorization")));
	}

}
